let store = 0
export default {
  StoreFuiouAccount: {
    entity: { name: 'FuiouAccount', prefix: () => {
      store = localStorage.getItem('storeId')
      return `store/${store}`
    } },
    list: {
      disabled_actions: ['new', 'delete', 'edit'],
      query: {
        '@expands': '["entity.user.staffs"]'
      },
      list_display: [
        { property: 'outAcntNm', label: '真实姓名' },
        { property: 'licNo', label: '身份证' },
        { property: 'mobile', label: '手机号' },
        { property: 'outAcntNo', label: '银行卡号' },
        { property: 'user', label: '用户' },
        { property: 'user.balance.amount', label: '钱包余额' },
        {
          property: 'user.__metadata.staffs', label: '对应员工',
          component: {
            props: ['data'],
            data() {
              return {
                staff: null
              }
            },
            created() {
              if (this.data && this.data.length > 0) {
                this.staff = this.data.find(v => v.__metadata.store.id === Number(store))
              }
            },
            render(h) {
              if (this.staff) {
                return (
                  <el-tag>{this.staff.__metadata.name}</el-tag>
                )
              }
            }
          }
        }
      ]
    },
    form: {
      fields: '__all__'
    }
  }
}
